package com.hns.can.service.web;

import com.hns.can.base.entity.SysUserEntity;
import com.hns.can.common.domain.GridPage;
import com.hns.can.common.service.CommonInitParamService;
import com.hns.can.common.web.BaseController;
import com.hns.can.service.service.ElectFencAlmService;
import com.hns.can.service.vo.ElectFencAlmParamsVo;
import com.hns.can.service.vo.ElectFencAlmReportVo;
import com.hns.frame.mybatis.Pagination;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Arrays;
import java.util.List;

/**
 * 电子围栏报警Controller
 * @author:zhangzq
 * @email:
 * @version Revision 2.0.0
 */
@Controller
@RequestMapping("/electFencAlm")
public class ElectFencAlmController extends BaseController {

    @Autowired
    ElectFencAlmService electFencAlmService;
    @Autowired
    private CommonInitParamService commonInitParamService;

    /**
     * 分页查询电子围栏报警
     * @param vo
     * @author:zhangzq
     * @email:
     */
    @RequestMapping("/searchElectFencAlmPage")
    @ResponseBody
    public Object searchElectFencAlmPage(ElectFencAlmParamsVo vo)throws Exception {
        SysUserEntity user = this.getCurrentUser().getUser();
        commonInitParamService.initParamsLimitCar(vo, user, Arrays.asList("T_COMM_ELECT_FENC_ALM"));
        Pagination page = electFencAlmService.searchElectFencAlmPage(vo);
        GridPage grid = new GridPage(page);
        return this.getReturnResult(grid);
    }

    /**
     * 查询电子围栏报警统计信息
     * @param vo
     * @author:zhangzq
     * @email:
     */
    @RequestMapping("/searchElectFencStatis")
    @ResponseBody
    public Object searchElectFencStatis(ElectFencAlmParamsVo vo)throws Exception {
        SysUserEntity user = this.getCurrentUser().getUser();
        commonInitParamService.initParamsLimitCar(vo, user, Arrays.asList("T_COMM_ELECT_FENC_ALM"));
        List<ElectFencAlmReportVo> list = electFencAlmService.searchElectFencStatis(vo);
        return this.getReturnResult(list);
    }

    /**
     * 查询异常区报警信息
     * @param vo
     * @author:zhangzq
     * @email:
     */
    @RequestMapping("/searchElectFencExDetail")
    @ResponseBody
    public Object searchElectFencExDetail(ElectFencAlmParamsVo vo)throws Exception {
        SysUserEntity user = this.getCurrentUser().getUser();
        commonInitParamService.initParamsLimitCar(vo, user, Arrays.asList("T_COMM_ELECT_FENC_ALM"));
        Pagination page = electFencAlmService.searchElectFencExDetail(vo);
        GridPage grid = new GridPage(page);
        return this.getReturnResult(grid);
    }

}
